Skip to content

Parse Datadog ids and sampling priority from transient views - #13619

Draft
dougqh wants to merge 3 commits into
dougqh/transient-valuesfrom
dougqh/datadog-id-views
Draft

dougqh wants to merge 3 commits into
dougqh/transient-valuesfrom
dougqh/datadog-id-views

Conversation

@dougqh

@dougqh dougqh commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

What Does This Do

The Datadog extractor parses x-datadog-trace-id, x-datadog-parent-id and x-datadog-sampling-priority straight from a transient view of the value (#13618) when a carrier hands one, instead of from a decoded String. Extracted contexts are unchanged. No carrier hands views yet (part 5, Kafka).

Stacked on #13618. Part 4 of the value-views series. Includes #13616's commit (Parse decimal numbers from a CharSequence range), cherry-picked because #13616 is based on master; it drops out on rebase once #13616 lands.

Additional Notes

  • DatadogContextInterpreter.acceptTransient: for its three parse-only headers, parses the view with LongStringUtils.parseUnsignedLong / parseInt over the range (Parse decimal numbers from a CharSequence range #13616), which give what DDTraceId.from / DDSpanId.from / Integer.parseInt give for the same chars. Errors invalidate the context as before.
  • Exactness fallbacks: a value the String path would treat differently is copied and takes that path: one with a comma (firstHeaderValue keeps the part before it), or a trace id whose text isn't canonical (leading + or zero), since DDTraceId keeps the text it parsed and could print it back.
  • ExtractionCache's span id check parses the value as handed (view or String) with the same range parser.
  • No needless copies: a parse-only header is parsed by the style that owns it. The other styles' interpreters only need its value if the configuration names it (a request header tag, a baggage mapping, the client IP header), so ContextInterpreter.acceptTransient skips it without copying otherwise; the inferred proxy propagator reads only keys without a header constant from an indexed carrier. Without this, every interpreter in a compound extraction made its own copy of each view, which allocated more than decoding once.
  • Retention: the view is parsed within the call; nothing keeps it. The error log copies it.
  • Tests (ExtractorKeysForkedTest): for the Datadog extractor and the compound Datadog + W3C extractor, edge values (leading zeros, +, commas, junk, 0, unsigned and int limits, overflow) give the same context from views as from Strings; and overwriting every view after extraction leaves the context unchanged (nothing kept a view). With the earlier checks: 47 tests.

🤖 Generated with Claude Code

@dougqh dougqh added comp: core Tracer core tag: performance Performance related changes type: refactoring tag: ai generated Largely based on code generated by an AI or LLM labels Nov 21, 2026
@datadog-datadog-prod-us1

datadog-datadog-prod-us1 Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🎯 Code Coverage (details)
• Patch Coverage: 84.14%
• Overall Coverage: 59.62% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 11bb1c7 | Docs | Give us feedback!

@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 60b0a1f to 34e9eee Compare November 21, 2026 15:11
@dd-octo-sts

dd-octo-sts Bot commented Nov 21, 2026 •

Copy link
Copy Markdown
Contributor

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results
Scenario Candidate master Δ (95% CI of mean)
startup:insecure-bank:iast:Agent 14.01 s 14.07 s [-1.4%; +0.4%] (no difference)
startup:insecure-bank:tracing:Agent 12.99 s 13.03 s [-1.0%; +0.3%] (no difference)
startup:petclinic:appsec:Agent 17.84 s 17.74 s [-0.4%; +1.6%] (no difference)
startup:petclinic:iast:Agent 17.62 s 17.18 s [-1.8%; +7.0%] (no difference)
startup:petclinic:profiling:Agent 17.62 s 17.40 s [+0.2%; +2.3%] (maybe worse)
startup:petclinic:sca:Agent 17.82 s 17.88 s [-1.2%; +0.6%] (no difference)
startup:petclinic:tracing:Agent 16.95 s 17.03 s [-1.5%; +0.6%] (no difference)

Commit: 11bb1c73 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@pr-commenter

pr-commenter Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Kafka / producer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch dougqh/transient-values dougqh/datadog-id-views
git_commit_date 1795289482 1795289484
git_commit_sha 14e69c0 11bb1c7
See matching parameters
Baseline Candidate
ci_job_date 1795290886 1795290886
ci_job_id 2286653780 2286653780
ci_pipeline_id 155480156 155480156
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-71umqq72 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-71umqq72 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-disabled-benchmarks/KafkaProduceBenchmark.benchProduce same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaProduceBenchmark.benchProduce same

@pr-commenter

pr-commenter Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Kafka / consumer-benchmark

Parameters

Baseline Candidate
baseline_or_candidate baseline candidate
git_branch dougqh/transient-values dougqh/datadog-id-views
git_commit_date 1795289482 1795289484
git_commit_sha 14e69c0 11bb1c7
See matching parameters
Baseline Candidate
ci_job_date 1795291187 1795291187
ci_job_id 2286653785 2286653785
ci_pipeline_id 155480156 155480156
cpu_model Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz Intel(R) Xeon(R) Platinum 8259CL CPU @ 2.50GHz
jdkVersion 11.0.31 11.0.31
jmhVersion 1.36 1.36
jvm /usr/lib/jvm/java-11-openjdk-amd64/bin/java /usr/lib/jvm/java-11-openjdk-amd64/bin/java
jvmArgs -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=15002 -Dhttps.proxyHost=127.0.0.1 -Dhttps.proxyPort=15002 -Dhttp.nonProxyHosts=localhost *.localhost
kernel_version Linux runner-zfyrx7zua-project-304-concurrent-0-h1qwpyq9 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux Linux runner-zfyrx7zua-project-304-concurrent-0-h1qwpyq9 6.8.0-1031-aws #33~22.04.1-Ubuntu SMP Thu Jun 26 14:22:30 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
vmName OpenJDK 64-Bit Server VM OpenJDK 64-Bit Server VM
vmVersion 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu 11.0.31+11-post-1ubuntu1-22.04.2-Ubuntu

Summary

Found 0 performance improvements and 0 performance regressions! Performance is the same for 3 metrics, 0 unstable metrics.

See unchanged results
scenario Δ mean throughput
scenario:not-instrumented/KafkaConsumerBenchmark.benchConsume unsure
[-13558.120op/s; -288.940op/s] or [-4.535%; -0.097%]
scenario:only-tracing-dsm-disabled-benchmarks/KafkaConsumerBenchmark.benchConsume same
scenario:only-tracing-dsm-enabled-benchmarks/KafkaConsumerBenchmark.benchConsume same

@dougqh
dougqh force-pushed the dougqh/transient-values branch from f476891 to 42b4292 Compare November 21, 2026 19:14
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 34e9eee to 06bd242 Compare November 21, 2026 19:14
dougqh and others added 3 commits November 21, 2026 14:31
Adds parseUnsignedLong / parseLong / parseInt overloads to LongStringUtils
that take the range [start, end) of a CharSequence and give the same result,
or NumberFormatException, as their String counterparts on the same chars
(Java 8 has no range-based CharSequence overloads of Long.parseLong /
Integer.parseInt). They let a header value be parsed in place, from a view,
without making a String first. parseUnsignedLong(String) now shares its
19-20 digit path with the range overload.

LongStringUtilsRangeTest compares outcomes with the String parsers on edge
cases (signs, Unicode digits, every length boundary, overflow) and on
random input.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Datadog interpreter overrides acceptTransient: the trace id, parent id
and sampling priority are parsed straight from the view with
LongStringUtils' range parsers, which give what the String path does for
the same chars. Values that path would treat differently (comma-separated
values, or a trace id whose text isn't canonical, since DDTraceId keeps the
text it parsed) are copied and take it. ExtractionCache's span id check
parses the value as handed too. Nothing keeps a view.

ExtractorKeysForkedTest checks edge values (leading zeros, '+', commas,
junk, unsigned / int limits) give the same context from views as from
Strings, and that overwriting the views after extraction changes nothing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A parse-only header is parsed by the style that owns it; the other styles'
interpreters only need its value if the configuration names it (a request
header tag, a baggage mapping, the client IP header), so ContextInterpreter
skips it without copying the view otherwise. The inferred proxy propagator
reads only keys without a header constant from an indexed carrier, since a
known header never has its prefix. Without these, every interpreter in a
compound extraction made its own copy of each view.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dougqh
dougqh force-pushed the dougqh/datadog-id-views branch from 06bd242 to 11bb1c7 Compare November 21, 2026 19:39
@dougqh
dougqh force-pushed the dougqh/transient-values branch from 42b4292 to 14e69c0 Compare November 21, 2026 19:39

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: core Tracer core tag: ai generated Largely based on code generated by an AI or LLM tag: performance Performance related changes type: refactoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant